<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>需求详情 - 社交平台</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #4f46e5;
            --primary-light: #818cf8;
            --primary-dark: #3730a3;
            --secondary: #ec4899;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --text-tertiary: #94a3b8;
            --bg-light: #f8fafc;
            --bg-white: #ffffff;
            --bg-gray: #f1f5f9;
            --bg-gray-dark: #e2e8f0;
            --border-light: #e2e8f0;
            --border-medium: #cbd5e1;
            --radius: 12px;
            --radius-sm: 8px;
            --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 60px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
        }
        
        .nav-title {
            font-size: 1.1rem;
            font-weight: 600;
            text-align: center;
            flex: 1;
        }
        
        .nav-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1.2rem;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .nav-action:hover {
            background-color: var(--bg-light);
        }
        
        .nav-action.primary {
            color: var(--primary);
        }
        
        /* 内容容器 */
        .content-container {
            padding: 16px;
        }
        
        /* 需求发布者信息 */
        .requester-info {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 16px;
        }
        
        .requester-avatar {
            width: 56px;
            height: 56px;
            border-radius: 50%;
            overflow: hidden;
            flex-shrink: 0;
        }
        
        .requester-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .requester-details {
            flex: 1;
        }
        
        .requester-name {
            font-weight: 600;
            font-size: 1rem;
            display: flex;
            align-items: center;
        }
        
        .verify-badge {
            color: var(--primary);
            font-size: 0.85rem;
            margin-left: 6px;
        }
        
        .requester-meta {
            font-size: 0.8rem;
            color: var(--text-tertiary);
            margin-top: 2px;
        }
        
        .contact-btn {
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 20px;
            padding: 6px 14px;
            font-size: 0.85rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 6px;
            white-space: nowrap;
        }
        
        /* 需求内容 */
        .demand-content {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            padding: 16px;
            margin-bottom: 16px;
            box-shadow: var(--shadow);
        }
        
        .demand-title {
            font-size: 1.2rem;
            font-weight: 600;
            margin-bottom: 12px;
            line-height: 1.4;
        }
        
        .demand-description {
            font-size: 0.95rem;
            color: var(--text-primary);
            line-height: 1.6;
            margin-bottom: 16px;
        }
        
        /* 图片展示区 */
        .demand-images {
            margin-bottom: 16px;
        }
        
        .image-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 6px;
        }
        
        .demand-image {
            aspect-ratio: 1;
            border-radius: var(--radius-sm);
            overflow: hidden;
            position: relative;
        }
        
        .demand-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        /* 需求信息标签 */
        .demand-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 16px;
        }
        
        .meta-item {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.85rem;
            color: var(--text-secondary);
        }
        
        .meta-item .value {
            color: var(--text-primary);
            font-weight: 500;
        }
        
        .tags-container {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 16px;
        }
        
        .tag {
            background-color: var(--bg-gray);
            color: var(--text-secondary);
            padding: 4px 12px;
            border-radius: 16px;
            font-size: 0.8rem;
        }
        
        /* 操作按钮区 */
        .action-buttons {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
        }
        
        .action-btn {
            flex: 1;
            padding: 10px 0;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }
        
        .primary-action {
            background-color: var(--primary);
            color: white;
        }
        
        .secondary-action {
            background-color: var(--bg-gray);
            color: var(--text-secondary);
        }
        
        /* 分割线 */
        .section-divider {
            height: 12px;
            background-color: var(--bg-light);
            margin: 8px 0 16px;
        }
        
        /* 留言区域 */
        .comments-section {
            margin-bottom: 20px;
        }
        
        .section-title {
            font-size: 1.1rem;
            font-weight: 600;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .section-title .count {
            font-size: 0.85rem;
            color: var(--text-secondary);
            font-weight: normal;
        }
        
        /* 留言输入框 */
        .comment-input-container {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            padding: 12px;
            margin-bottom: 16px;
            box-shadow: var(--shadow);
        }
        
        .comment-input-wrapper {
            display: flex;
            gap: 10px;
        }
        
        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            overflow: hidden;
            flex-shrink: 0;
        }
        
        .user-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .comment-input {
            flex: 1;
        }
        
        .comment-textarea {
            width: 100%;
            border: 1px solid var(--border-light);
            border-radius: 20px;
            padding: 10px 14px;
            resize: none;
            font-size: 0.9rem;
            min-height: 44px;
            line-height: 1.4;
        }
        
        .comment-textarea:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .comment-actions {
            display: flex;
            justify-content: flex-end;
            margin-top: 8px;
        }
        
        .send-comment {
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 20px;
            padding: 6px 16px;
            font-size: 0.85rem;
            font-weight: 500;
        }
        
        /* 留言列表 */
        .comments-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        
        /* 留言项 */
        .comment-item {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            padding: 14px;
            box-shadow: var(--shadow);
        }
        
        .comment-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
        }
        
        .comment-author {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .author-avatar {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            overflow: hidden;
        }
        
        .author-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .author-info {
            display: flex;
            flex-direction: column;
        }
        
        .author-name {
            font-weight: 500;
            font-size: 0.9rem;
        }
        
        .comment-time {
            font-size: 0.75rem;
            color: var(--text-tertiary);
        }
        
        .comment-menu {
            color: var(--text-tertiary);
            background: none;
            border: none;
            font-size: 1rem;
        }
        
        .comment-content {
            font-size: 0.95rem;
            line-height: 1.5;
            margin-bottom: 10px;
            color: var(--text-primary);
        }
        
        .comment-actions {
            display: flex;
            gap: 16px;
        }
        
        .comment-action {
            display: flex;
            align-items: center;
            gap: 4px;
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 0.85rem;
        }
        
        .comment-action.liked {
            color: var(--primary);
        }
        
        /* 回复区域 */
        .replies-container {
            margin-top: 12px;
            padding-left: 16px;
            border-left: 2px solid var(--bg-gray);
        }
        
        .reply-item {
            padding: 8px 0;
            border-bottom: 1px solid var(--bg-gray);
        }
        
        .reply-item:last-child {
            border-bottom: none;
        }
        
        .reply-content {
            font-size: 0.9rem;
            line-height: 1.4;
            margin-bottom: 6px;
        }
        
        .reply-author {
            font-weight: 500;
            color: var(--primary);
        }
        
        .reply-actions {
            display: flex;
            gap: 16px;
            font-size: 0.8rem;
        }
        
        .reply-action {
            display: flex;
            align-items: center;
            gap: 4px;
            color: var(--text-secondary);
            background: none;
            border: none;
        }
        
        .reply-input-container {
            margin-top: 10px;
            display: flex;
            gap: 8px;
        }
        
        .reply-input {
            flex: 1;
            position: relative;
        }
        
        .reply-textarea {
            width: 100%;
            border: 1px solid var(--border-light);
            border-radius: 16px;
            padding: 6px 12px;
            resize: none;
            font-size: 0.85rem;
            min-height: 36px;
        }
        
        .reply-textarea:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .send-reply {
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 16px;
            padding: 4px 12px;
            font-size: 0.8rem;
            align-self: flex-end;
        }
        
        .show-more-replies {
            color: var(--primary);
            background: none;
            border: none;
            font-size: 0.85rem;
            padding: 8px 0;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 60px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            gap: 4px;
            flex: 1;
            height: 100%;
            text-decoration: none;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        .nav-icon {
            font-size: 1.2rem;
        }
        
        /* 提示消息 */
        .toast {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 0.85rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast.show {
            opacity: 1;
        }
        
        /* 加载更多 */
        .load-more {
            padding: 12px 0;
            text-align: center;
        }
        
        .load-more-btn {
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            color: var(--text-secondary);
            padding: 6px 20px;
            border-radius: 20px;
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            gap: 6px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-action" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">需求详情</div>
        <button class="nav-action" id="shareBtn">
            <i class="fas fa-share-alt"></i>
        </button>
    </div>
    
    <!-- 内容容器 -->
    <div class="content-container">
        <!-- 需求发布者信息 -->
        <div class="requester-info">
            <div class="requester-avatar">
                <img src="https://picsum.photos/id/64/100/100" alt="用户头像">
            </div>
            <div class="requester-details">
                <div class="requester-name">
                    张小明 <i class="fas fa-check-circle verify-badge"></i>
                </div>
                <div class="requester-meta">
                    发布于 2小时前 · 距离 2.5km
                </div>
            </div>
            <button class="contact-btn">
                <i class="fas fa-comment"></i>
                <span>联系TA</span>
            </button>
        </div>
        
        <!-- 需求内容 -->
        <div class="demand-content">
            <div class="demand-title">求购二手摄影器材一套，预算3000-5000元</div>
            
            <div class="demand-description">
                寻找一套入门级摄影器材，包含相机机身和镜头，最好是佳能或尼康品牌，成色较新，功能完好。希望快门次数较少，无拆修记录。<br><br>
                主要用于旅行摄影和日常记录，有意者请附带详细参数、购买时间和成色说明，最好能提供实物照片。可当面交易验货，价格可议。
            </div>
            
            <!-- 图片展示 -->
            <div class="demand-images">
                <div class="image-grid">
                    <div class="demand-image">
                        <img src="https://picsum.photos/id/237/300/300" alt="参考图1">
                    </div>
                    <div class="demand-image">
                        <img src="https://picsum.photos/id/96/300/300" alt="参考图2">
                    </div>
                    <div class="demand-image">
                        <img src="https://picsum.photos/id/201/300/300" alt="参考图3">
                    </div>
                </div>
            </div>
            
            <!-- 需求信息标签 -->
            <div class="demand-meta">
                <div class="meta-item">
                    <i class="fas fa-money-bill" style="color: var(--primary);"></i>
                    <span>预算: <span class="value">¥3000-5000</span></span>
                </div>
                <div class="meta-item">
                    <i class="fas fa-clock" style="color: var(--warning);"></i>
                    <span>有效期: <span class="value">30天</span></span>
                </div>
                <div class="meta-item">
                    <i class="fas fa-eye" style="color: var(--secondary);"></i>
                    <span>浏览: <span class="value">215</span></span>
                </div>
            </div>
            
            <div class="tags-container">
                <span class="tag">摄影器材</span>
                <span class="tag">求购</span>
                <span class="tag">可议价</span>
                <span class="tag">当面交易</span>
                <span class="tag">佳能</span>
                <span class="tag">尼康</span>
            </div>
        </div>
        
        <!-- 操作按钮区 -->
        <div class="action-buttons">
            <button class="action-btn primary-action" id="offerBtn">
                <i class="fas fa-hand-holding-heart"></i>
                <span>我能提供</span>
            </button>
            <button class="action-btn secondary-action" id="favoriteBtn">
                <i class="far fa-bookmark"></i>
                <span>收藏</span>
            </button>
            <button class="action-btn secondary-action" id="reportBtn">
                <i class="fas fa-flag"></i>
                <span>举报</span>
            </button>
        </div>
        
        <div class="section-divider"></div>
        
        <!-- 留言区域 -->
        <div class="comments-section">
            <div class="section-title">
                <i class="far fa-comment"></i>
                <span>留言回复</span>
                <span class="count">(32)</span>
            </div>
            
            <!-- 留言输入框 -->
            <div class="comment-input-container">
                <div class="comment-input-wrapper">
                    <div class="user-avatar">
                        <img src="https://picsum.photos/id/22/100/100" alt="当前用户头像">
                    </div>
                    <div class="comment-input">
                        <textarea class="comment-textarea" placeholder="发表你的看法..."></textarea>
                        <div class="comment-actions">
                            <button class="send-comment" id="sendCommentBtn">发送</button>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 留言列表 -->
            <div class="comments-list">
                <!-- 留言项1 -->
                <div class="comment-item">
                    <div class="comment-header">
                        <div class="comment-author">
                            <div class="author-avatar">
                                <img src="https://picsum.photos/id/91/100/100" alt="评论者头像">
                            </div>
                            <div class="author-info">
                                <div class="author-name">王摄影</div>
                                <div class="comment-time">1小时前</div>
                            </div>
                        </div>
                        <button class="comment-menu">
                            <i class="fas fa-ellipsis-h"></i>
                        </button>
                    </div>
                    <div class="comment-content">
                        我有一套佳能EOS R50，去年购买，快门次数不到5000，配18-45mm镜头，成色99新，无任何划痕，有原装包装盒和发票，你感兴趣吗？可以提供详细照片。
                    </div>
                    <div class="comment-actions">
                        <button class="comment-action like-btn">
                            <i class="far fa-thumbs-up"></i>
                            <span>12</span>
                        </button>
                        <button class="comment-action reply-btn">
                            <i class="far fa-comment"></i>
                            <span>回复</span>
                        </button>
                    </div>
                    
                    <!-- 回复区域 -->
                    <div class="replies-container">
                        <!-- 回复1 -->
                        <div class="reply-item">
                            <div class="reply-content">
                                <span class="reply-author">张小明</span>：感兴趣的，请问具体配置和价格是多少？能发几张实物照片看看吗？
                            </div>
                            <div class="reply-actions">
                                <button class="reply-action">
                                    <i class="far fa-thumbs-up"></i>
                                    <span>3</span>
                                </button>
                                <button class="reply-action reply-to-reply-btn">
                                    <i class="far fa-comment"></i>
                                    <span>回复</span>
                                </button>
                            </div>
                        </div>
                        
                        <!-- 回复输入框 -->
                        <div class="reply-input-container">
                            <div class="user-avatar">
                                <img src="https://picsum.photos/id/22/100/100" alt="当前用户头像">
                            </div>
                            <div class="reply-input">
                                <textarea class="reply-textarea" placeholder="回复 @王摄影..."></textarea>
                            </div>
                            <button class="send-reply">发送</button>
                        </div>
                    </div>
                </div>
                
                <!-- 留言项2 -->
                <div class="comment-item">
                    <div class="comment-header">
                        <div class="comment-author">
                            <div class="author-avatar">
                                <img src="https://picsum.photos/id/65/100/100" alt="评论者头像">
                            </div>
                            <div class="author-info">
                                <div class="author-name">李器材</div>
                                <div class="comment-time">2小时前</div>
                            </div>
                        </div>
                        <button class="comment-menu">
                            <i class="fas fa-ellipsis-h"></i>
                        </button>
                    </div>
                    <div class="comment-content">
                        尼康D5600套机要不？18-140mm镜头，2022年购入，很少使用，几乎全新，带UV镜和相机包，4500元出，可小刀。
                    </div>
                    <div class="comment-actions">
                        <button class="comment-action like-btn">
                            <i class="far fa-thumbs-up"></i>
                            <span>8</span>
                        </button>
                        <button class="comment-action reply-btn">
                            <i class="far fa-comment"></i>
                            <span>回复</span>
                        </button>
                    </div>
                    
                    <!-- 回复区域 -->
                    <div class="replies-container">
                        <!-- 回复1 -->
                        <div class="reply-item">
                            <div class="reply-content">
                                <span class="reply-author">张小明</span>：价格有点超预算了，最低能多少出？
                            </div>
                            <div class="reply-actions">
                                <button class="reply-action">
                                    <i class="far fa-thumbs-up"></i>
                                    <span>1</span>
                                </button>
                                <button class="reply-action reply-to-reply-btn">
                                    <i class="far fa-comment"></i>
                                    <span>回复</span>
                                </button>
                            </div>
                        </div>
                        
                        <!-- 回复2 -->
                        <div class="reply-item">
                            <div class="reply-content">
                                <span class="reply-author">李器材</span>：最低4200，不议价了，这个成色很值了
                            </div>
                            <div class="reply-actions">
                                <button class="reply-action">
                                    <i class="far fa-thumbs-up"></i>
                                    <span>0</span>
                                </button>
                                <button class="reply-action reply-to-reply-btn">
                                    <i class="far fa-comment"></i>
                                    <span>回复</span>
                                </button>
                            </div>
                        </div>
                        
                        <button class="show-more-replies">查看更多3条回复</button>
                    </div>
                </div>
                
                <!-- 留言项3 -->
                <div class="comment-item">
                    <div class="comment-header">
                        <div class="comment-author">
                            <div class="author-avatar">
                                <img src="https://picsum.photos/id/29/100/100" alt="评论者头像">
                            </div>
                            <div class="author-info">
                                <div class="author-name">赵老师</div>
                                <div class="comment-time">昨天 18:30</div>
                            </div>
                        </div>
                        <button class="comment-menu">
                            <i class="fas fa-ellipsis-h"></i>
                        </button>
                    </div>
                    <div class="comment-content">
                        建议考虑一下富士的相机，色彩很好，适合旅行摄影，我有朋友出XT30二代，套机4800，需要的话可以帮你问问。
                    </div>
                    <div class="comment-actions">
                        <button class="comment-action like-btn">
                            <i class="far fa-thumbs-up"></i>
                            <span>5</span>
                        </button>
                        <button class="comment-action reply-btn">
                            <i class="far fa-comment"></i>
                            <span>回复</span>
                        </button>
                    </div>
                </div>
            </div>
            
            <!-- 加载更多留言 -->
            <div class="load-more">
                <button class="load-more-btn" id="loadMoreComments">
                    <i class="fas fa-spinner fa-spin" style="display: none;"></i>
                    <span>加载更多留言</span>
                </button>
            </div>
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home nav-icon"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass nav-icon"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-list-alt nav-icon"></i>
            <span>需求</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-bell nav-icon"></i>
            <span>通知</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user nav-icon"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- 提示消息元素 -->
    <div class="toast" id="toast"></div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById('backBtn');
        const shareBtn = document.getElementById('shareBtn');
        const offerBtn = document.getElementById('offerBtn');
        const favoriteBtn = document.getElementById('favoriteBtn');
        const reportBtn = document.getElementById('reportBtn');
        const sendCommentBtn = document.getElementById('sendCommentBtn');
        const loadMoreComments = document.getElementById('loadMoreComments');
        const likeButtons = document.querySelectorAll('.like-btn');
        const replyButtons = document.querySelectorAll('.reply-btn, .reply-to-reply-btn');
        const contactBtn = document.querySelector('.contact-btn');
        
        // 返回按钮
        backBtn.addEventListener('click', function() {
            history.back();
        });
        
        // 分享按钮
        shareBtn.addEventListener('click', function() {
            showToast('分享功能已打开');
        });
        
        // 我能提供按钮
        offerBtn.addEventListener('click', function() {
            showToast('已打开提供服务页面');
        });
        
        // 收藏按钮
        favoriteBtn.addEventListener('click', function() {
            const icon = this.querySelector('i');
            if (icon.classList.contains('far')) {
                icon.classList.remove('far');
                icon.classList.add('fas');
                showToast('已收藏该需求');
            } else {
                icon.classList.remove('fas');
                icon.classList.add('far');
                showToast('已取消收藏');
            }
        });
        
        // 举报按钮
        reportBtn.addEventListener('click', function() {
            showToast('举报功能已打开');
        });
        
        // 发送评论
        sendCommentBtn.addEventListener('click', function() {
            const textarea = document.querySelector('.comment-textarea');
            const commentText = textarea.value.trim();
            
            if (commentText) {
                showToast('评论已发送');
                textarea.value = '';
            } else {
                showToast('请输入评论内容');
            }
        });
        
        // 加载更多评论
        loadMoreComments.addEventListener('click', function() {
            const spinner = this.querySelector('.fa-spinner');
            const text = this.querySelector('span');
            const originalText = text.textContent;
            
            spinner.style.display = 'inline-block';
            text.textContent = '加载中...';
            this.disabled = true;
            
            setTimeout(() => {
                spinner.style.display = 'none';
                text.textContent = originalText;
                this.disabled = false;
                showToast('已加载更多留言');
            }, 1500);
        });
        
        // 点赞功能
        likeButtons.forEach(button => {
            button.addEventListener('click', function() {
                const icon = this.querySelector('i');
                const countSpan = this.querySelector('span');
                let count = parseInt(countSpan.textContent);
                
                if (icon.classList.contains('far')) {
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                    this.classList.add('liked');
                    countSpan.textContent = count + 1;
                    showToast('点赞成功');
                } else {
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                    this.classList.remove('liked');
                    countSpan.textContent = count - 1;
                    showToast('已取消点赞');
                }
            });
        });
        
        // 回复功能
        replyButtons.forEach(button => {
            button.addEventListener('click', function() {
                const text = this.closest('.comment-item') ? 
                    this.closest('.comment-item').querySelector('.author-name')?.textContent :
                    this.closest('.reply-item').querySelector('.reply-author')?.textContent;
                
                if (text) {
                    const replyTextarea = this.closest('.replies-container') ? 
                        this.closest('.replies-container').querySelector('.reply-textarea') :
                        this.closest('.comment-item').querySelector('.reply-textarea');
                    
                    if (replyTextarea) {
                        replyTextarea.focus();
                        replyTextarea.placeholder = `回复 @${text}...`;
                    } else {
                        showToast('准备回复...');
                    }
                }
            });
        });
        
        // 联系发布者
        contactBtn.addEventListener('click', function() {
            showToast('已打开聊天窗口');
        });
        
        // 提示消息功能
        function showToast(message) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.classList.add('show');
            
            setTimeout(() => {
                toast.classList.remove('show');
            }, 2000);
        }
    </script>
</body>
</html>

